package cn.suimg.neo4j.util;

import java.util.*;

public class Aria2Util {

    public static String download(String url,String saveDir,String saveName){
        String id = UUID.randomUUID().toString();
        HttpClientUtil.postJson("http://192.168.0.100:6800/jsonrpc",new HashMap<String, Object>(){{
            put("jsonrpc","2.0");
            put("method","aria2.addUri");
            put("id",id);
            put("params",new ArrayList<Object>(){{
                add("token:Suimg1017.");
                add(Collections.singletonList(url));
                add(new HashMap<String,Object>(){{
                    put("dir","/downloads/" + saveDir);
                    put("out",saveName);
                }});
            }});
        }});
        return id;
    }
}
